local yinfu = fk.CreateSkill {
  name = "cf_yinfu",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
  ["cf_yinfu"] = "殷富",
  [":cf_yinfu"] = "锁定技，你的基本牌不计入手牌上限。每回合限三次，你可以将两张牌当作任意基本牌使用或打出。",
  ["#cf_yinfu"] = "将两张牌当作任意基本牌使用或打出。"
}

yinfu:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return player:hasSkill(yinfu.name) and card.type == card.TypeBasic
  end,
})

yinfu:addEffect("viewas", {
  pattern = ".|.|.|.|.|basic",
  filter_pattern = function(self, player, card_name, selected)
    return {
      min_num = 2,
      max_num = 2,
      pattern = ".",
    }
  end,
  prompt = "#cf_yinfu",
  interaction = function(self, player)
    local all_names = Fk:getAllCardNames("b")
    local names = player:getViewAsCardNames(yinfu.name, all_names)
    if #names == 0 then return end
    return UI.CardNameBox { choices = names, all_choices = all_names }
  end,
  handly_pile = true,
  view_as = function(self, player, cards)
    if not self.interaction.data or #cards ~= 2 then return end
    local card = Fk:cloneCard(self.interaction.data)
    card:addSubcards(cards)
    card.skillName = yinfu.name
    return card
  end,
  include_equip = true,
  enabled_at_play = function(self, player)
    return player:hasSkill(yinfu.name) and player:usedEffectTimes(self.name, Player.HistoryTurn) <= 2
  end,
})

return yinfu
